/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
window.nonameWebsite = (function() {
    'use strict';
    var _init = function() {
        khanhhoi.menuRender();
        $(document).on("click", ".sf-menu li a", function() {
            var plugin = $(this).attr("data-value");
            var isSinglepage = $(this).attr("data-cview");
            khanhhoi.pageRender(plugin, function(data) {
                $("ul.sf-menu li a[data-value='" + data.PLUGIN + "']").parent().addClass("current");
                $("ul.sf-menu li a[data-value!='" + data.PLUGIN + "']").parent().removeClass("current");
                $("div.extra_container").remove();
                $("head section[id!='style_" + data.PLUGIN + "']").remove();
                //console.log(data.STYLE);
                $("head").append("<section id=\"style_" + data.PLUGIN + "\">" + data.STYLE + "</section>");
                $.smoothScroll({
                    scrollTarget: '#main-content'
                });
            }, isSinglepage);

            window.history.pushState("object or string", "Title", "?plugin=" + plugin);
            return false;
        });
        $(document).on("click", ".btn-more", function() {
            $.smoothScroll({
                scrollTarget: '#main-content'
            });
            return false;
        });
    };
    return {
        init: _init
    };
})(window);

$(document).ready(function() {
    nonameWebsite.init();
});

